export interface AnyObject {
  [key: string]: any;
}

export type MethodTypes =
  | "GET"
  | "POST"
  | "PUT"
  | "DELETE"
  | "CONNECT"
  | "HEAD"
  | "OPTIONS"
  | "TRACE";

export interface RequestOptions {
  url: string;
  method: MethodTypes;
  data?: AnyObject;
  header?: AnyObject;
}

export interface ResponseType<T> {
  code: number;
  message: string;
  success: boolean;
  data: T
}

/*
  泛型工具类型：
    Omit  排除
    Pick  挑选（包含）
    Required 必选
    Partial  可选
    
      Omit<RequestOptions, 'url' | 'method'>  --> { data?, header? }
      Pick<RequestOptions, 'url' | 'method'>  --> { url, method }
      Required<RequestOptions> 将所有属性变成必选
      Partial<RequestOptions> 将所有属性变成可选
*/
